package com.company.cloud.page.client;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.common.bean.LoginSimpleUserInfo;
import com.company.cloud.common.exception.BusinessException;
import com.company.cloud.page.modules.api.models.PageComponentModel;
import com.company.cloud.page.modules.api.request.*;
import com.company.cloud.page.modules.api.response.PageComponentPageResponse;
import com.company.cloud.page.modules.api.service.PageComponentClientService;
import com.company.cloud.page.modules.mgr.service.WebPageComponentConfigMgrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RestController;

@Deprecated
@RestController
@Service
public class PageComponentClientServiceImpl implements PageComponentClientService {


    @Override
    public BaseClientResult<String> save(PageComponentSave2UpdateRequest params) {
        try {
//            pageComponentMgrService.save(PageConvertUtils.getPageComponentSaveParam(params),
//                    getDefUserInfo(params.getClientUserId(), params.getClientUserIp()));
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e);
        }
    }

    @Override
    public BaseClientResult<String> update(PageComponentSave2UpdateRequest params) {
        try{
//            pageComponentMgrService.update(PageConvertUtils.getPageComponentSaveParam(params),
//                    getDefUserInfo(params.getClientUserId(), params.getClientUserIp()));
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e);
        }
    }

    @Override
    public BaseClientResult<String> updateState(PageComponentUpdateStateParam params) {
        try{
//            pageComponentMgrService.updateState(params, getDefUserInfo(params.getClientUserId(), params.getClientUserIp()));
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e);
        }
    }

    @Override
    public BaseClientResult<String>  delete(PageComponentDeleteRequest params) {
        try{
//            pageComponentMgrService.delete(params.getCode(), getDefUserInfo(params.getClientUserId(), params.getClientUserIp()));
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e);
        }
    }

    @Override
    public BaseClientResult<PageComponentPageResponse> query(PageComponentQueryParam params) {
        try {
//            PageComponentPageResponse page = new PageComponentPageResponse(pageComponentMgrService.query(params));
//            return BaseClientResult.success(page);
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e);
        }
    }

    @Override
    public BaseClientResult<PageComponentModel> getById(String code) {
        try {
//            return BaseClientResult.success(pageComponentMgrService.getById(code));
            return BaseClientResult.success();
        } catch (BusinessException e) {
            return BaseClientResult.error(e.getCode(), e.getMsg());
        }
    }


}
